package util;


public class Filter {
	float lastValue;
	float weight;
	
	public Filter(float weight){
		this.weight = weight;
	}
	
	public float filter(float f){
		lastValue =  weight * f + (1 - weight) * lastValue;
		return lastValue;
	}
	
	public void setWeight(float weight){
		this.weight = weight;
	}
	
	public void setLastValue(float v){
		lastValue = v;
	}
	
	public float getWeight(){
		return weight;
	}

}
